<?php
$url = new Url();
?>
<script src="<?=Yii::app()->params["urlRs"] ?>/js/messenger.js" type="text/javascript"></script>
<div class="naptien">
    <h2><strong class="clred">Hòm Thư</strong></h2>
</div>
<div class="Tabs clearfix">
    <div class="fl">
        <ul class="clearfix">      
            <li><a href="<?=$url->createUrl("messenger/index")?>" class="active"><span><strong>Thư đã nhận</strong></span></a></li>
            <li><a href="<?=$url->createUrl("messenger/sentMessenger")?>"><span><strong>Thư đã gửi</strong></span></a></li>
            <li class="last"><a href="<?=$url->createUrl("messenger/compose")?>"><span><strong>Gửi thư</strong></span></a></li>
        </ul>
    </div>
    <div class="fr" style="display: none" id="bt_del"><button class="btn-redSmall" type="submit" onclick="deleteMultiRow();"><span><b>Xóa</b></span></button></div>
</div>

<div class="box_tab">
    <div class="tab_inner">
        <div class="tab_cont">
            <div class="inner_tab_cont">
                <div class="box_white">
                <?php if($count_row > 0){?> 
                    <div class="table7">
                    
                        <table border="0">
                            <tbody>
                                <tr class="title_gt">
                                    <td width="7%"><input type="checkbox" id="check_box" value="<?=$count_row?>" onclick="checkAll();"/></td>
                                    <td width="48%"><strong>Tiêu đề</strong></td>
                                    <td width="22%"><strong>Người gửi</strong></td>
                                    <td width="23%"><strong>Thời gian</strong></td>
                                </tr>
                                <?php foreach($messenger as $key=>$value){?>
                                <?php $time_int = strtotime($value['create_date']); ?>
                                <tr>
                                    <td><input type="checkbox" value="<?=$value['id']?>" id="check_box<?=$key?>" onclick="showButton();" name="" /></td>
                                    <?php if($value['is_read'] == 1){?>
                                    <td class="text-left"><a href="<?=$url->createUrl('messenger/detail',array("id"=>$value['id'],"cat"=>1))?>"><?=$value['subject']?></a></td>
                                    <?php }else{?>
                                    <td class="text-left"><a href="<?=$url->createUrl('messenger/detail',array("id"=>$value['id'],"cat"=>1))?>"><strong><?=$value['subject']?></a></strong></td> 
                                    <?php }?>
                                    <td><p><strong><?=$value['sender_name']?></strong></p></td>
                                    <td>
                                    <p><?=date('H',$time_int)?>h:<?=date('i',$time_int)?>'</p>
                                    <p><?=date('d/m/Y',$time_int)?></p>
                                    </td>
                                </tr>
                                <?php }?>
                            </tbody>
                        </table>

                    
                    </div>
                    <div class="fillters clearfix">
                    <div class="fl" id="result_submit"></div> 
                        <ul class="paging fr">
                            <?=isset($page)?$page:""?>
                        </ul>
                    </div>
                    <?php }else{?>
                    <p align="center"><span><strong>Không có thư mới !</strong></span></p>
                    <?php }?>
                    
                </div>
            </div>
        </div>
    </div>
</div>
